//
//  OrdinaryMessageVController.m
//  优学荟管理系统
//
//  Created by edz on 2018/2/27.
//  Copyright © 2018年 星道三好. All rights reserved.
//

#import "OrdinaryMessageVController.h"

@interface OrdinaryMessageVController ()<UITextViewDelegate>
@property(nonatomic,strong)UILabel *lab;
@property(nonatomic,strong)UITextView *filedView;
@property(nonatomic,copy)NSString *examineText;
@end

@implementation OrdinaryMessageVController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"机构反馈";
    self.view.backgroundColor=RGBColor(245, 245, 245);
    [self setUI];
}
-(void)setUI
{
    //反馈意见
    _filedView = [[UITextView alloc]init];
    [self.view addSubview:_filedView];
    _filedView.backgroundColor=[UIColor whiteColor];
    [_filedView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.offset(10);
        make.right.offset(-10);
        make.height.offset(180);
    }];
    _filedView.delegate = self;
    //设置是否可以编辑
    _filedView.editable = YES;
    _filedView.textColor = [UIColor blackColor];
    
    
    _filedView.font = [UIFont fontWithName:@"Arial"size:18.0];
   
    
    self.lab=[[UILabel alloc]init];
    [_filedView addSubview:self.lab];
    [self.lab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(10);
        make.top.offset(10);
    }];
    self.lab.text=@"请输入您的宝贵意见";
    self.lab.textColor=RGBColor(153, 153, 153);
    self.lab.font=[UIFont systemFontOfSize:15];
    
    //添加图片
    
    UILabel *addLab = [[UILabel alloc]init];
    [self.view addSubview:addLab];
    addLab.text=@"添加图片";
    addLab.textColor=RGBColor(153, 153, 153);
    addLab.font=[UIFont systemFontOfSize:15];
    [addLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(25);
        make.top.equalTo(_filedView.mas_bottom).offset(10);
    }];
    
    
    UIView *addBackView = [[UIView alloc]init];
    [self.view addSubview:addBackView];
    addBackView.backgroundColor=[UIColor whiteColor];
    [addBackView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(10);
        make.top.equalTo(addLab.mas_bottom).offset(10);
        make.right.offset(-10);
        make.height.offset(120);
    }];
    for (int i=0; i<2; i++) {
        UIButton *addBtn = [[UIButton alloc]init];
        [addBackView addSubview:addBtn];
        [addBtn setBackgroundImage:[UIImage imageNamed:@"icon_add_default_HomeWork"] forState:0];
        
        [addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.offset(15+(80+30)*i);
            make.top.offset(20);
            make.width.height.offset(80);
        }];
    }
    
   
    
    //提交按钮
    
    UIButton *comitBtn = [[UIButton alloc]init];
    [self.view addSubview:comitBtn];
    [comitBtn setTitle:@"提交" forState:0];
    [comitBtn addTarget:self action:@selector(comitMessage) forControlEvents:UIControlEventTouchUpInside];
    [comitBtn setBackgroundImage:[UIImage imageNamed:@"1btn_ensure_default"] forState:0];
    [comitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(25);
        make.right.offset(-25);
        make.bottom.offset(-20);
        make.height.offset(45);
    }];
   
}
-(void)comitMessage
{
    
}
- (void)textViewDidChange:(UITextView *)textView {
    
    self.examineText = textView.text;
    
    if(textView.text.length == 0) {  
        self.lab.text = @"请输入您的宝贵意见";
        
    }else {
        
        self.lab.text = @"";
        
    }
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
